package com.ruoyi.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.domain.HomePage;
import com.ruoyi.service.IHomePageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.HomePageMapper;

/**
 * 首页轮播图Service业务层处理
 *
 * @author ruoyi
 * @date 2025-02-10
 */
@Service
public class HomePageServiceImpl extends ServiceImpl<HomePageMapper, HomePage> implements IHomePageService
{
    @Autowired
    private HomePageMapper homePageMapper;

    /**
     * 查询首页轮播图
     *
     * @param homePageId 首页轮播图主键
     * @return 首页轮播图
     */
    @Override
    public HomePage selectHomePageByHomePageId(Long homePageId)
    {
        return homePageMapper.selectHomePageByHomePageId(homePageId);
    }

    /**
     * 查询首页轮播图列表
     *
     * @param homePage 首页轮播图
     * @return 首页轮播图
     */
    @Override
    public List<HomePage> selectHomePageList(HomePage homePage)
    {
        return homePageMapper.selectHomePageList(homePage);
    }

    /**
     * 新增首页轮播图
     *
     * @param homePage 首页轮播图
     * @return 结果
     */
    @Override
    public int insertHomePage(HomePage homePage)
    {
        homePage.setCreateTime(DateUtils.getNowDate());
        return homePageMapper.insertHomePage(homePage);
    }

    /**
     * 修改首页轮播图
     *
     * @param homePage 首页轮播图
     * @return 结果
     */
    @Override
    public int updateHomePage(HomePage homePage)
    {
        homePage.setUpdateTime(DateUtils.getNowDate());
        return homePageMapper.updateHomePage(homePage);
    }

    /**
     * 批量删除首页轮播图
     *
     * @param homePageIds 需要删除的首页轮播图主键
     * @return 结果
     */
    @Override
    public int deleteHomePageByHomePageIds(Long[] homePageIds)
    {
        return homePageMapper.deleteHomePageByHomePageIds(homePageIds);
    }

    /**
     * 删除首页轮播图信息
     *
     * @param homePageId 首页轮播图主键
     * @return 结果
     */
    @Override
    public int deleteHomePageByHomePageId(Long homePageId)
    {
        return homePageMapper.deleteHomePageByHomePageId(homePageId);
    }
}
